<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>S110_nRF51822/Include/ble/ble_sdk_util.h File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css" />
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="alias.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="alias.js"></script>

<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>


<script type="text/javascript">
  jQuery(document).ready(function () {
    if(gref){ // Number all _img and _table classes
      gref();
    }
  });
</script>

</head>
<body>
<div id="top"><!-- do not remove this div! -->

<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">nRF51822 BLE SDK
   
   </div>
   
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.5 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>Globals</span></a></li>
    </ul>
  </div>
</div>
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
  initNavTree('ble__sdk__util_8h.html','');
</script>
<div id="doc-content">
<div class="header">
  <div class="summary">
<a href="#nested-classes">Data Structures</a> &#124;
<a href="#define-members">Defines</a> &#124;
<a href="#typedef-members">Typedefs</a> &#124;
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">S110_nRF51822/Include/ble/ble_sdk_util.h File Reference</div>  </div>
</div>
<div class="contents">
<div class="textblock"><code>#include &lt;stdint.h&gt;</code><br/>
<code>#include &quot;compiler_abstraction.h&quot;</code><br/>
</div>
<p><a href="ble__sdk__util_8h_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr><td colspan="2"><h2><a name="nested-classes"></a>
Data Structures</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structuint8__array__t.html">uint8_array_t</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Byte array type.  <a href="structuint8__array__t.html#details">More...</a><br/></td></tr>
<tr><td colspan="2"><h2><a name="define-members"></a>
Defines</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ga36d525cf4d116b2fe4ecc00222b256f1"></a><!-- doxytag: member="ble_sdk_util.h::PACKED" ref="ga36d525cf4d116b2fe4ecc00222b256f1" args="" -->
#define&#160;</td><td class="memItemRight" valign="bottom"><b>PACKED</b>&#160;&#160;&#160;__packed</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__ble__sdk__lib__util.html#ga6259b9f2ea4ab48312b1836c71f484bb">GPIO_PIN_CONFIG</a>(PIN_NO, IO_OUTPUT, IO_PULL, IO_DRIVE, IO_SENSE)&#160;&#160;&#160;_GPIO_PIN_CONFIG(PIN_NO, IO_OUTPUT, IO_PULL, IO_DRIVE, IO_SENSE)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Macro to configure an I/O.  <a href="group__ble__sdk__lib__util.html#ga6259b9f2ea4ab48312b1836c71f484bb"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__ble__sdk__lib__util.html#ga3f8d3d1b629cf9a61a86886059987e6a">GPIO_LED_CONFIG</a>(PIN_NO)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Configure a PIN to be used as a LED.  <a href="group__ble__sdk__lib__util.html#ga3f8d3d1b629cf9a61a86886059987e6a"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__ble__sdk__lib__util.html#ga5f313d1d9c2c322ca6b265f597ab7c7d">GPIO_DEBUG_PIN_CONFIG</a>(PIN_NO)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Configure a PIN to be used as a debug pin (e.g. to be monitored using a logic analyzer).  <a href="group__ble__sdk__lib__util.html#ga5f313d1d9c2c322ca6b265f597ab7c7d"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__ble__sdk__lib__util.html#gaf4e57e59f98b21778ea8f231423816fd">GPIOTE_BUTTON_CONFIG</a>(PIN_NO)&#160;&#160;&#160;_GPIOTE_BUTTON_CONFIG(PIN_NO)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Configure a PIN to be used as a push button.  <a href="group__ble__sdk__lib__util.html#gaf4e57e59f98b21778ea8f231423816fd"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__ble__sdk__lib__util.html#ga61149a977f6ebdaeb8bdeed626dd9392">CRITICAL_REGION_ENTER</a>()</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Macro for entering a critical region.  <a href="group__ble__sdk__lib__util.html#ga61149a977f6ebdaeb8bdeed626dd9392"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__ble__sdk__lib__util.html#ga854878240b628e978f760f75aca4e1cc">CRITICAL_REGION_EXIT</a>()</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Macro for leaving a critical region.  <a href="group__ble__sdk__lib__util.html#ga854878240b628e978f760f75aca4e1cc"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__ble__sdk__lib__util.html#ga25e8110559dbc9665dfb9485be8ac60f">ROUNDED_DIV</a>(A, B)&#160;&#160;&#160;(((A) + ((B) / 2)) / (B))</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Perform rounded integer division (as opposed to truncating the result).  <a href="group__ble__sdk__lib__util.html#ga25e8110559dbc9665dfb9485be8ac60f"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__ble__sdk__lib__util.html#ga7aaa817cfd7ed354f09db5675ffe1427">CEIL_DIV</a>(A, B)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Perform integer division, making sure the result is rounded up.  <a href="group__ble__sdk__lib__util.html#ga7aaa817cfd7ed354f09db5675ffe1427"></a><br/></td></tr>
<tr><td colspan="2"><h2><a name="typedef-members"></a>
Typedefs</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="gaa6f104ea023a4a6a56ef05f30b0cfdc3"></a><!-- doxytag: member="ble_sdk_util.h::uint16_le_t" ref="gaa6f104ea023a4a6a56ef05f30b0cfdc3" args="[2]" -->
typedef uint8_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__ble__sdk__lib__util.html#gaa6f104ea023a4a6a56ef05f30b0cfdc3">uint16_le_t</a> [2]</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">type for holding an encoded (i.e. little endian) 16 bit unsigned integer. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ga634aa3136e273c2a368023ce97e73f01"></a><!-- doxytag: member="ble_sdk_util.h::uint32_le_t" ref="ga634aa3136e273c2a368023ce97e73f01" args="[4]" -->
typedef uint8_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__ble__sdk__lib__util.html#ga634aa3136e273c2a368023ce97e73f01">uint32_le_t</a> [4]</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">type for holding an encoded (i.e. little endian) 32 bit unsigned integer. <br/></td></tr>
<tr><td colspan="2"><h2><a name="func-members"></a>
Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">static __INLINE uint8_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__ble__sdk__lib__util.html#gab58c28346b89382397aa7a716bf9a178">uint16_encode</a> (uint16_t value, uint8_t *p_encoded_data)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Inline function for encoding a uint16 value.  <a href="group__ble__sdk__lib__util.html#gab58c28346b89382397aa7a716bf9a178"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">static __INLINE uint8_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__ble__sdk__lib__util.html#gad960286275534b81d75fbeba2d52aec9">uint32_encode</a> (uint32_t value, uint8_t *p_encoded_data)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Inline function for encoding a uint32 value.  <a href="group__ble__sdk__lib__util.html#gad960286275534b81d75fbeba2d52aec9"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">static __INLINE uint16_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__ble__sdk__lib__util.html#gaf30655fd762a9debe0b499db3a9451f7">uint16_decode</a> (const uint8_t *p_encoded_data)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Inline function for decoding a uint16 value.  <a href="group__ble__sdk__lib__util.html#gaf30655fd762a9debe0b499db3a9451f7"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">static __INLINE uint32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__ble__sdk__lib__util.html#gaa8eaa6f05cd43462e58a24e54c0ddacd">uint32_decode</a> (const uint8_t *p_encoded_data)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Inline function for decoding a uint32 value.  <a href="group__ble__sdk__lib__util.html#gaa8eaa6f05cd43462e58a24e54c0ddacd"></a><br/></td></tr>
</table>
<hr/><a name="details" id="details"></a><h2>Detailed Description</h2>
<div class="textblock">
<p>Definition in file <a class="el" href="ble__sdk__util_8h_source.html">ble_sdk_util.h</a>.</p>
</div></div>
</div>
  <div id="nav-path" class="navpath">
    <ul>
      <li class="navelem"><a class="el" href="ble__sdk__util_8h.html">ble_sdk_util.h</a>      </li>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Data Structures</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Defines</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>


    <li class="footer">
      Copyright &copy 2006-2011 <a href="http://www.nordicsemi.no" style="text-decoration:none">Nordic Semiconductor</a>.
      All Rights Reserved.
      <a href="disclaimer.html">Disclaimer</a>
    </li>
   </ul>
 </div>


</body>
</html>
